﻿using CardLogistics.Web.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace CardLogistics.Web.MainPage.PutOutCard.PutOutSendCard
{
    public partial class PutOutSendCardMontRpt : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindRpt();
            }
        }

        /// <summary>
        /// 绑定Rpt数据
        /// </summary>
        private void BindRpt()
        {
            //string month = Request.QueryString["month"];//月份
            //StringBuilder sbStr = new StringBuilder();
            //sbStr.Append(" SELECT * FROM v_putoutsendcard_detail WHERE 1=1  and Issubmit=5");
            //if (month.Trim().Length > 0)
            //    sbStr.Append(" and to_char(LEADINGDATE,'yyyy-MM') ='" + month.Trim() + "'");//年月
            //sbStr.Append(" Order by PUTOUTCARDNO ");
            //OracleXMLReportData.GenNodeXmlData(this, sbStr.ToString(), true);

            //20170419 by pengqiao 修改成品发放月报表修改列表字段，需显示字段包含：单号、领用日期、领用单位、卡类型、是否启用、单卡成本、单卡预充值金额、应有张数、实际张数。
            string month = Request.QueryString["month"];//月份
            StringBuilder sbStr = new StringBuilder();
            sbStr.Append(" SELECT SendNo,LeadingDate,SalesName,cardtypename,FlagName,FgvAmt,sum(PrechArge) as PrechArge,sum(DueNumber) as DueNumber,sum(ActualNumber) as ActualNumber FROM v_putoutsendcard_detail WHERE 1=1  and Issubmit=5");
            if (month.Trim().Length > 0)
                sbStr.Append(" and to_char(LEADINGDATE,'yyyy-MM') ='" + month.Trim() + "'");//年月
            sbStr.Append(" group by SendNo,LeadingDate,SalesName,cardtypename,FlagName,FgvAmt");
            sbStr.Append(" Order by SendNo ");
            OracleXMLReportData.GenNodeXmlData(this, sbStr.ToString(), true);
        }
    }
}